package fr.cephb.joperon.core.db;



import com.sleepycat.db.DatabaseEntry;
import com.sleepycat.db.DatabaseException;



import fr.cephb.joperon.core.Operon;
import fr.cephb.joperon.core.OperonDBUniqFid;
import fr.cephb.joperon.core.bio.Chromosome;
import fr.cephb.joperon.core.bio.Organism;
import fr.cephb.joperon.core.entities.SnpSeq;




/**
 * AbstractSnpMapDB
 * @author lindenb
 *
 */
public abstract class AbstractSnpSeqDB
	extends OperonDBUniqFid<SnpSeq>
	{
	public AbstractSnpSeqDB(Operon operon)
		{
		super(operon);
		}
	
	@Override
	public abstract String getName();
	
	
	public abstract Organism getOrganism();
	
	
	@Override
	public SnpSeq readValue(DatabaseEntry key,DatabaseEntry data) throws DatabaseException
		{
		return new SnpSeq(data);
		}
	
	
	@Override
	protected DatabaseEntry valueToEntry(SnpSeq value) throws DatabaseException {
		return value.toEntry();
		}
	
	

	
	public ValueIterator listBetween(Chromosome chr,int start,int end )  throws DatabaseException
		{
		FidEntriesIterator iter= new FidEntriesIterator(getOrganism(),chr,start,end);
		return new ValueIterator(iter);
		}
	
	

	
	}


